/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.wiai.untl.core.dao.jpa;

import com.wiai.untl.core.dao.DosenDAO;
import com.wiai.untl.core.entity.Departemen;
import com.wiai.untl.core.entity.Dosen;
import com.wiai.untl.core.entity.Fakultas;
import java.util.List;

/**
 *
 * @author Hendro Steven
 */
public class DosenDAOImpl extends GeneralDAOImpl implements DosenDAO {

    @Override
    public List<Dosen> getAllDosen() {
        return getJpaTemplate().find("SELECT d FROM Dosen d");
    }

    @Override
    public List<Dosen> getByDepartemen(Departemen departemen) {
        return getJpaTemplate().find("SELECT d From Dosen d WHERE d.departemen=?1", departemen);
    }

    @Override
    public List<Dosen> getByFakultas(Fakultas fakultas) {
        return getJpaTemplate().find("SELECT d From Dosen d Where d.departemen.fakultas=?1",fakultas);
    }

    @Override
    public Dosen getById(long id) {
       return (Dosen)getJpaTemplate().find(Dosen.class, id);
    }
}
